<template>
  <div class="public_main">
    <div class="crumbs">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item>{{$t('sidebar.borrowBack')}}</el-breadcrumb-item>
        <el-breadcrumb-item>{{$t('serviceManage.crumbsOne')}}</el-breadcrumb-item>
        <el-breadcrumb-item>{{$t('serviceManage.crumbsThree')}}</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    
    <!-- -------------搜索查询栏------------------------ -->
    <search 
			:searchData="searchData" 
			@search="search" 
			:searchRight="true"
			:outputRight="false"
    ></search>

    <!-- -------------表单显示栏------------------------ -->
    <div class="table">
      <template>
        <el-table :data="tableData" size="small" v-loading="loadFlag" stripe @selection-change="handleSelectionChange">
          <el-table-column align="center" prop="id" :label="$t('public.orderId')">
          </el-table-column>
          <el-table-column align="center" prop="userId" :label="$t('public.userId')">
          </el-table-column>
          <el-table-column align="center" prop="userName" :label="$t('public.name')">
          </el-table-column>
          <el-table-column align="center" prop="userPhone" :label="$t('public.userTel')">
          </el-table-column>
          <el-table-column align="center" prop="loanAmount" :label="$t('public.no30')">
            <template slot-scope="scope">
              <span v-if="scope.row.loanAmount!==null&&scope.row.loanAmount!==undefined&&scope.row.loanAmount!==''">{{$store.state.common.id_currency}}{{$store.getters.moneySplit(scope.row.loanAmount)}}{{$store.state.common.vi_currency}}</span>
              <span v-else>{{$store.state.common.nullData}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" prop="productPeriod" :label="$t('public.no31')">
          </el-table-column>
          <el-table-column align="center" prop="overdueDays" :label="$t('public.no28')">
            </el-table-column>
          <el-table-column align="center" prop="loanTime" :label="$t('public.no58')" width="86">
          </el-table-column>
          <el-table-column align="center" prop="mustRefundTime" :label="$t('public.no59')" width="86">
          </el-table-column>
          <el-table-column align="center" prop="serviceAllotTime" :label="$t('public.no90')" width="86">
          </el-table-column>
          <el-table-column align="center" prop="serviceStatus" :label="$t('new.no34')" min-width="80">
            <template slot-scope="scope">
              <span>{{$t($store.getters.myoveNoticeStatus(scope.row.serviceStatus))}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" prop="status" :label="$t('public.orderStatus')">
            <template slot-scope="scope">
              <span>{{$t($store.getters.rejectStatus(scope.row.status))}}</span>
            </template>
          </el-table-column>
            <!-- <el-table-column align="center" prop="callStartTime" :label="$t('new.no87')" width="86">
              <template slot-scope="scope">
              <span>{{scope.row.callStartTime}}-{{scope.row.callEndTime}}</span>
            </template>
            </el-table-column>
            <el-table-column align="center" prop="callStatus" :label="$t('new.no88')">
              <template slot-scope="scope">
                <span >{{$t($store.getters.callStatus_status(scope.row.callStatus))}}</span>
              </template>
            </el-table-column> -->
            <el-table-column align="center" prop="orderCustomerStageName" :label="$t('add.no12')">
            </el-table-column>
          <el-table-column fixed="right" align="center" prop="operation" :label="$t('public.operation')" min-width="120">
            <template slot-scope="scope">
              <span 
                v-if="$store.state.common.permiss.myremindlist.includes('remind')"
                class="table_opr" 
                @click="detail(scope.row.userId,scope.row.id,scope.row.userName,scope.row.status)"           >
              {{$t('public.no29')}}
              </span>
            </template>
          </el-table-column>
        </el-table>
      </template>
    </div>

    <!-- ------------  分页显示栏  ------------------------ -->
    <el-row type="flex" justify="end">
      <div class="pages" >
        <el-pagination
          @current-change="handleCurrentChange"
          :current-page="pagination.current"
          layout="sizes, prev, pager, next, total,->"
          :page-sizes="pagination.pageSizeOptions"
          :page-size="pagination.pageSize"
          @size-change="handleSizeChange"
          :total="pagination.total">
        </el-pagination>
      </div>
    </el-row>

    <div class="foot"></div>

  </div>
</template>
<script>
import getApp from 'src/mixins/getApp.js';//获取app和aok
import getStage from 'src/mixins/getCustomerStage.js';//获取客服阶段
export default {
  mixins:[getApp,getStage],
  data () {
      const searchData=[
      {
        type: 'input',
        label: 'public.orderId',
        attr: 'orderId',
        value: ''
      },
      {
        type: 'input',
        label: 'public.userId',
        attr: 'userId',
        value: ''
      },
      {
        type: 'input',
        label: 'public.name',
        attr: 'name',
        value: ''
      },
      {
        type: 'input',
        label: 'public.userPhone',
        attr: 'phone',
        value: ''
      },{
        type: 'input',
        label: 'serviceManage.service',
        attr: 'serviceName',
        value: ''
      },{
        type: 'select',
        attr: 'orderState',
        label: 'public.orderStatus',
        option: this.$store.state.options.order_select,
        value: '',
        langFlag: true,
      },{
        type: 'select',
        attr: 'serviceStatus',
        label: 'new.no34',
        option: this.$store.state.options.notice_option,
        value: '',
        langFlag: true,
      },{
        type: 'select',
        attr: 'remindType',
        label: 'add.no12',
        option:[],
        value: '',
        langFlag: false,
      },{
        type: 'doubleInput',
        attr: ['overdueBegin','overdueEnd'],
        label: 'public.no28',
        value: [],
      },{
        type: 'rangePicker',
        label: 'teleMarketing.no11',
        attr: 'searchTime1',
        value: [],
      },{
        type: 'rangePicker',
        label: 'public.CreateTime',
        attr: 'searchTime2',
        value: [],
      },{
        type: 'rangePicker',
        label: 'serviceManage.paidantime',
        attr: 'searchTime3',
        value: [],
      },
      // {
      //   type: 'rangePicker',
      //   label: 'new.no87',
      //   attr: 'searchTime4',
      //   value: [],
      // },{
      //   type: 'select',
      //   attr: 'callStatus',
      //   label: 'new.no88',
      //   option: this.$store.state.options.groupCalls_options,
      //   langFlag: true,
      // },
      {
        type: 'select',
        attr: 'appName',
        label: 'public.appName',
        option: [],
        langFlag: false,
      },{
        type: 'select',
        attr: 'appPackage',
        label: 'public.appPackage',
        option: [],
        langFlag: false,
      }
    ]
    return {
      flag: true,
      loadFlag: true,
      pagination: {
        pageSize: global.config.pageSize,
        pageSizeOptions: global.config.pageSizeOptions,
        current: 1,
        total: 0,
      },
      searchData:searchData,
      formInline: {
        orderId: '',
        userId: '',
        name: '',
        phone: '',
        serviceName: '',
        orderState:'',
        serviceStatus:'',
        remindType:'',
        overdueBegin:'',
        overdueEnd:'',
        callStatus:'',
        appName:'',
        appPackage:''
      },
      tableData: [], // 用户信息数据模拟
    }
  },
  methods: {
    handleSizeChange (val) {// 每页条数变化时操作
      this.pagination.pageSize = val;
      this.getTableData();
    },
    handleCurrentChange (val) { // 分页按钮点击操作
      this.pagination.current = val;
      this.getTableData();
    },
    search(search) { // 搜索
        this.formInline=search;
        this.formInline.loanTimeBegin=search.searchTime1?search.searchTime1[0]:'';
        this.formInline.loanTimeEnd=search.searchTime1?search.searchTime1[1]:'';
        this.formInline.mustRefundTimeBegin=search.searchTime2?search.searchTime2[0]:'';
        this.formInline.mustRefundTimeEnd=search.searchTime2?search.searchTime2[1]:'';
        this.formInline.serviceTimeBegin=search.searchTime3?search.searchTime3[0]:'';
        this.formInline.serviceTimeEnd=search.searchTime3?search.searchTime3[1]:'';
        this.formInline.callTimeBegin=search.searchTime4?search.searchTime4[0]:'';
        this.formInline.callTimeEnd=search.searchTime4?search.searchTime4[1]:'';
        if (this.flag) {
          this.flag = false;
          this.pagination.current = 1;
          this.getTableData();
        }
    },
    detail(userId, orderId,userName,status) { // 点击查看详情
        this.$router.push({path: '/myreminddetail', query: {userId, orderId,userName,status}});   
    },
    getTableData () { // 获取初审列表数据
      this.loadFlag = true;
      let option = {
        pageNum:this.pagination.current,
        pageSize:this.pagination.pageSize,
        param: {
          ...this.formInline
        }       
      }
      this.$axios.post(this.$action.remind_mylist, option).then(res => {
        this.flag = true;
        if (res.code == 200) {
          this.tableData = res.data.list;
          this.pagination.total = res.data.total;
        }else{
          this.$globalMsg.error(res.data.message)
        }
        this.loadFlag = false;
      })
    },
    handleSelectionChange (val) { // 表格选中项数据
      this.multipleSelection = val;
    }
  },
  mounted () {
    this.getApp().then(app=>{
      this.searchData[14].option=app.appName;
      this.searchData[15].option=app.appPackage;
    })
    this.getStage().then(arr=>{
      this.searchData[7].option=arr;
    })
    this.getTableData();// 获取初审列表数据
  }
}
</script>
<style scoped lang="scss">

</style>
